<?php
// 生成验证码
/**
 * 类型为 register,  注册
 * 类型为 login,     登录
 * 类型为 send,		发帖
 * 类型为 reply1,	快捷回帖1
 * 类型为 reply2,	正式回帖2
 * 类型为 
 */

include '../function/value.func.php';
include '../function/image.func.php';

$codeType = getV($_GET, 'codeType');
static $codeList = ['register', 'login', 'send', 'reply1', 'reply2'];

// 检测数据
if ($codeType === NULL || !in_array($codeType, $codeList)){
	echo '参数错误';
	$url = getV($_SERVER, 'HTTP_REFERER');
	echo '<meta http-equiv="refresh" content="3,url="'.$url.'>';
	exit ();
}

// 绘制图片,记录code
session_start();
$string    = rand_character();
draw_validate_code($string, '../resource/font/Comic Sans MS Bold.ttf');
$codeType .= '_validate_code';
$_SESSION[$codeType] = $string;


	